import json
with open("log.txt", "w", encoding="utf-8") as f:
    with open('log_ori.txt', 'r') as file:
        for line in file:
            try:
                data = json.loads(line)
                rssi = float("nan")
                element_exists = None
                max_rssi = -9999
                for e in data["access_points"]:
                    if e['ssid'] == 'AutoXing':
                        max_rssi = max(max_rssi, e['rssi'])
                if max_rssi != -9999:
                    rssi = max_rssi
            except Exception as _:
                pass

            strs = f"{data['x']} {data['y']} {rssi}\n"
            f.write(strs)
            # print(f"{data['x']} {data['y']} {rssi}")